var secondGeDom = document.querySelector('#second_ge');

var itemHeight = 120;
var totalTime = 12;
var curTime = 0;
var timerId = null;

function init() {
  beginTimer();
  initEvent();
}

function initEvent() {
  secondGeDom.addEventListener('transitionend', function () {
    if (curTime % 10 === 0) {
      secondGeDom.style.transition = 'none';
      secondGeDom.style.top = 0;
    }
  });
}

function beginTimer() {
  if (timerId) {
    return;
  }
  timerId = setInterval(() => {
    curTime++;
    if (curTime > totalTime) {
      clearInterval(timerId);
      timerId = null;
      return;
    }
    console.log(curTime);
    //secondGeDom.style.marginTop = -itemHeight * curTime + 'px';
    if (curTime % 10 === 0) {
        
    }else {
        secondGeDom.style.transition = 'all 0.5s linear';
    }
    secondGeDom.style.transition = 'all 0.5s linear';
    secondGeDom.style.top = -itemHeight * (curTime % 10) + 'px';
  }, 1000);
}

init(); //初始化
